#include"head.h"
int is_true(MYSQL *mysql,char*name,char*pass,char**user_id){
    char end_sql[200]={0};
    sprintf(end_sql,"select password_hash,salt ,user_id from bd_user where username='%s'",name);
    mysql_query(mysql,end_sql);
    MYSQL_RES *result=mysql_store_result(mysql);
    int num=mysql_num_rows(result);
    if(num==0){
        return 1;
    }
    MYSQL_ROW row= mysql_fetch_row(result);
    char *end_hash=crypt(pass,row[1]);
    if(strcmp(row[0],end_hash)!=0){
        return 1;
    }
    *user_id=row[2];
    return 0;
}

